package com.ldp.designpatterns.study.decorator.concreteDecorator;

import com.ldp.designpatterns.study.decorator.component.Coffee;
import com.ldp.designpatterns.study.decorator.decorator.CoffeeDecorator;

/**
 * @ClassName MilkDecorator
 * @Description 装饰模式_
 * TODO:4:具体装饰器（Concrete Decorator）：扩展了装饰器类，通过添加额外的功能来装饰具体组件。。
 * @Author lindipei
 * @Date 2023/10/17 14:38
 */
//实现具体的装饰器类
public class SugarDecorator extends CoffeeDecorator {

    public SugarDecorator(Coffee coffee) {
        super(coffee);
    }

    @Override
    public double cost() {
        return super.cost() + 0.5;
    }

    @Override
    public String description() {
        return super.description() + ", with Sugar";
    }
}
